import {
  BwComPropSetConstValueComEnum,
  BwCustomComPropDataTypeEnum,
  BwCustomComEmitParamDataTypeEnum,
  BwCustomComSlotParamDataTypeEnum,
  BwCustomComSoltTypeEnum,
} from '../../../render/models'
import type {
  BwCustomComEmitInfoModel,
  BwCustomComSlotInfoModel,
  BwCustomComPropInfoModel,
} from '../../../render/models'

/** 组件属性 */
const comAttrs: Array<BwCustomComPropInfoModel> = [
  {
    key: 'class',
    name: 'classNames',
    isRequire: false,
    defaultValue: undefined,
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.array,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'modelValue',
    name: '值(v-model)',
    isModel: true,
    isRequire: false,
    defaultValue: undefined,
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.number,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'title',
    name: '顶部标题',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'options',
    name: '可选项数据源',
    isRequire: false,
    defaultValue: '[]',
    dataType: [BwCustomComPropDataTypeEnum.object],
    defaultValueDataType: BwCustomComPropDataTypeEnum.object,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'placeholder',
    name: '未选中时的提示文案',
    isRequire: false,
    defaultValue: '请选择',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'active-color',
    name: '选中状态的高亮颜色',
    isRequire: false,
    defaultValue: '#1989fa',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.color,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'swipeable',
    name: '是否开启手势左右滑动切换',
    isRequire: false,
    defaultValue: 'true',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'closeable',
    name: '是否显示关闭图标',
    isRequire: false,
    defaultValue: 'true',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'show-header',
    name: '是否展示标题栏',
    isRequire: false,
    defaultValue: 'true',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'close-icon',
    name: '关闭图标名称或图片链接',
    isRequire: false,
    defaultValue: 'cross',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'field-names',
    name: '自定义 options 结构中的字段',
    isRequire: false,
    defaultValue: JSON.stringify({
      text: 'text',
      value: 'value',
      children: 'children',
    }),
    dataType: [BwCustomComPropDataTypeEnum.object],
    defaultValueDataType: BwCustomComPropDataTypeEnum.object,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
]

/** 组件事件 */
const comEmits: Array<BwCustomComEmitInfoModel> = [
  {
    key: 'update:modelValue',
    name: '输入框内容变化时触发',
    isModel: true,
    params: [
      {
        paramKey: 'value',
        paramName: '值',
        paramDataType: BwCustomComEmitParamDataTypeEnum.array,
        remark: '',
      },
    ],
  },
  {
    key: 'change',
    name: '选中项变化时触发',
    params: [
      {
        paramKey: 'value',
        paramName: '值',
        paramDataType: BwCustomComEmitParamDataTypeEnum.string,
        remark: '',
      },
      {
        paramKey: 'selectedOptions',
        paramName: 'selectedOptions',
        paramDataType: BwCustomComEmitParamDataTypeEnum.array,
        remark: '',
      },
      {
        paramKey: 'tabIndex',
        paramName: 'tabIndex',
        paramDataType: BwCustomComEmitParamDataTypeEnum.number,
        remark: '',
      },
    ],
  },
  {
    key: 'finish',
    name: '全部选项选择完成后触发',
    params: [
      {
        paramKey: 'value',
        paramName: '值',
        paramDataType: BwCustomComEmitParamDataTypeEnum.string,
        remark: '',
      },
      {
        paramKey: 'selectedOptions',
        paramName: 'selectedOptions',
        paramDataType: BwCustomComEmitParamDataTypeEnum.array,
        remark: '',
      },
      {
        paramKey: 'selectedIndexes',
        paramName: 'selectedIndexes',
        paramDataType: BwCustomComEmitParamDataTypeEnum.array,
        remark: '',
      },
    ],
  },
  {
    key: 'close',
    name: '点击关闭图标时触发',
    params: [],
  },
  {
    key: 'click-tab',
    name: '点击标签时触发',
    params: [
      {
        paramKey: 'tabIndex',
        paramName: 'tabIndex',
        paramDataType: BwCustomComEmitParamDataTypeEnum.number,
        remark: '',
      },
      {
        paramKey: 'title',
        paramName: 'title',
        paramDataType: BwCustomComEmitParamDataTypeEnum.string,
        remark: '',
      },
    ],
  },
]

/** 组件插槽 */
const comSlots: Array<BwCustomComSlotInfoModel> = [
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'title',
      slotName: '自定义顶部标题',
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'option',
      slotName: '自定义选项文字',
      slotParams: [
        {
          paramKey: 'option',
          paramName: 'option',
          paramDataType: BwCustomComSlotParamDataTypeEnum.object,
          remark: '',
        },
        {
          paramKey: 'selected',
          paramName: 'selected',
          paramDataType: BwCustomComSlotParamDataTypeEnum.boolean,
          remark: '',
        },
      ],
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'options-top',
      slotName: '自定义选项上方的内容',
      slotParams: [
        {
          paramKey: 'tabIndex',
          paramName: 'tabIndex',
          paramDataType: BwCustomComSlotParamDataTypeEnum.number,
          remark: '',
        },
      ],
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'options-bottom',
      slotName: '自定义选项下方的内容',
      slotParams: [
        {
          paramKey: 'tabIndex',
          paramName: 'tabIndex',
          paramDataType: BwCustomComSlotParamDataTypeEnum.number,
          remark: '',
        },
      ],
    },
  },
]

export const vantCascaderInfo = {
  comAttrs,
  comEmits,
  comSlots,
}
